home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------
- // FirstMainMenu.cs ⌐ 2001 by Charles Petzold
- //--------------------------------------------
- using System;
- using System.Drawing;
- using System.Windows.Forms;
-
- class FirstMainMenu: Form
- {
- public static void Main()
- {
- Application.Run(new FirstMainMenu());
- }
- public FirstMainMenu()
- {
- Text = "Primer men· principal";
-
- // Elementos del submen· Archivo
-
- MenuItem miOpen = new MenuItem("&Abrir...",
- new EventHandler(MenuFileOpenOnClick),
- Shortcut.CtrlA);
-
- MenuItem miSave = new MenuItem("&Guardar",
- new EventHandler(MenuFileSaveOnClick),
- Shortcut.CtrlG);
-
- MenuItem miSaveAs = new MenuItem("G&uardar como...",
- new EventHandler(MenuFileSaveAsOnClick));
-
- MenuItem miDash = new MenuItem("-");
-
- MenuItem miExit = new MenuItem("&Salir",
- new EventHandler(MenuFileExitOnClick));
- // Elemento Archivo
-
- MenuItem miFile = new MenuItem("&Archivo",
- new MenuItem[] {miOpen, miSave, miSaveAs,
- miDash, miExit });
- // Elementos del submen· Edici≤n
-
- MenuItem miCut = new MenuItem("Cor&tar",
- new EventHandler(MenuEditCutOnClick),
- Shortcut.CtrlX);
-
- MenuItem miCopy = new MenuItem("&Copiar",
- new EventHandler(MenuEditCopyOnClick),
- Shortcut.CtrlC);
-
- MenuItem miPaste = new MenuItem("&Pegar",
- new EventHandler(MenuEditPasteOnClick),
- Shortcut.CtrlV);
- // Elemento Edici≤n
-
- MenuItem miEdit = new MenuItem("&Edici≤n",
- new MenuItem[] {miCut, miCopy, miPaste});
-
- // Elemento del submen· Ayuda
-
- MenuItem miAbout = new MenuItem("&Acerca de FirstMainMenu...",
- new EventHandler(MenuHelpAboutOnClick));
- // Elemento Ayuda
-
- MenuItem miHelp = new MenuItem("Ay&uda",
- new MenuItem[] {miAbout});
- // Men· principal
-
- Menu = new MainMenu(new MenuItem[] {miFile, miEdit, miHelp});
- }
- void MenuFileOpenOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show("íSeleccionado el elemento Archivo Abrir!", Text);
- }
- void MenuFileSaveOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show("íSeleccionado el elemento Archivo Guardar!", Text);
- }
- void MenuFileSaveAsOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show("íSeleccionado el elemento Archivo Guardar como!", Text);
- }
- void MenuFileExitOnClick(object obj, EventArgs ea)
- {
- Close();
- }
- void MenuEditCutOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show("Seleccionado el elemento Edici≤n Cortar!", Text);
- }
- void MenuEditCopyOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show("Seleccionado el elemento Edici≤n Copiar!", Text);
- }
- void MenuEditPasteOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show("Seleccionado el elemento Edici≤n Pegar!", Text);
- }
- void MenuHelpAboutOnClick(object obj, EventArgs ea)
- {
- MessageBox.Show(Text + " ⌐ 2001 por Charles Petzold");
- }
- }